﻿ #region Disclaimer/Info
 
 /////////////////////////////////////////////////////////////////////////////////////////////////
 //
 //   File:		IPageRepository.cs
 //   Website:		http://dexterblogengine.com/
 //   Authors:		http://dexterblogengine.com/About.ashx
 //   Rev:		1
 //   Created:		19/01/2011
 //   Last edit:		19/01/2011
 //   License:		GNU Library General Public License (LGPL)
 //   File:            IPageRepository.cs
 //   For updated news and information please visit http://dexterblogengine.com/
 //   Dexter is hosted to Codeplex at http://dexterblogengine.codeplex.com
 //   For any question contact info@dexterblogengine.com
 //
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 #endregion

using System;
using System.Collections.Generic;
using Dexter.Domain.Model;
using Dexter.Domain.Results;

namespace Dexter.Repository {

	/// <summary>
	/// 	Rapresents a repository of <see cref="Page"/>.
	/// </summary>
	public interface IPageRepository : IRepository <Page> {
		///<summary>
		///	Retrieve a page from a specific slug.
		///</summary>
		///<param name = "slug">The slug of the page.</param>
		///<returns>
		///	An instance of Page.
		///	The return item could be null if there isn't an item with the specified slug into the repository.
		///</returns>
		///<exception cref="ArgumentNullException"> If <paramref name="slug"/> is <c>null</c> or <c>empty</c>.</exception>
		Page GetBySlug ( string slug );

		///<summary>
		///	Retrieve a page from a specific slug.
		///</summary>
		///<param name = "slug">The slug of the page.</param>
		/// <param name = "enableTracking">if set to <c>true</c> the tracking system of the return object will be enable.</param>
		///<returns>
		///	An instance of Page.
		///	The return item could be null if there isn't an item with the specified slug into the repository.
		///</returns>
		///<exception cref="ArgumentNullException"> If <paramref name="slug"/> is <c>null</c> or <c>empty</c>.</exception>
		Page GetBySlug ( string slug , bool enableTracking );

		///<summary>
		///	Retrieve a page from a specific slug.
		///</summary>
		///<param name = "slug">The slug of the page.</param>
		///<returns>
		///	An instance of Page with its complete tree loaded.
		///	The return item could be null if there isn't an item with the specified slug into the repository.
		///</returns>
		///<exception cref="ArgumentNullException"> If <paramref name="slug"/> is <c>null</c> or <c>empty</c>.</exception>
		Page GetBySlugWithParent ( string slug );

		///<summary>
		///	Retrieve a page from a specific slug.
		///</summary>
		///<param name = "slug">The slug of the page.</param>
		/// <param name = "enableTracking">if set to <c>true</c> the tracking system of the return object will be enable.</param>
		///<returns>
		///	An instance of Page with its complete tree loaded.
		///	The return item could be null if there isn't an item with the specified slug into the repository.
		///</returns>
		///<exception cref="ArgumentNullException"> If <paramref name="slug"/> is <c>null</c> or <c>empty</c>.</exception>
		Page GetBySlugWithParent ( string slug , bool enableTracking );

		/// <summary>
		/// 	Retrieve a page from a specific key.
		/// </summary>
		/// <param name = "key">The key.</param>
		/// <returns>
		/// 	An instance of Page.
		/// 	The return item could be null if there isn't an item with the specified key into the repository.
		/// </returns>
		///<exception cref="ArgumentOutOfRangeException"> If <paramref name="key"/> is lesser then 1.</exception>
		Page GetByKey ( int key );

		/// <summary>
		/// 	Retrieve a page from a specific key.
		/// </summary>
		/// <param name = "key">The key.</param>
		/// <param name = "enableTracking">if set to <c>true</c> the tracking system of the return object will be enable.</param>
		/// <returns>
		/// 	An instance of Page.
		/// 	The return item could be null if there isn't an item with the specified key into the repository.
		/// </returns>
		///<exception cref="ArgumentOutOfRangeException"> If <paramref name="key"/> is lesser then 1.</exception>
		Page GetByKey ( int key , bool enableTracking );

		/// <summary>
		/// 	Retrieve a page from a specific key.
		/// </summary>
		/// <param name = "key">The key.</param>
		/// <returns>
		/// 	An instance of Page with its complete tree loaded.
		/// 	The return item could be null if there isn't an item with the specified key into the repository.
		/// </returns>
		///<exception cref="ArgumentOutOfRangeException"> If <paramref name="key"/> is lesser then 1.</exception>
		Page GetByKeyWithParent ( int key );

		/// <summary>
		/// 	Retrieve a page from a specific key.
		/// </summary>
		/// <param name = "key">The key.</param>
		/// <param name = "enableTracking">if set to <c>true</c> the tracking system of the return object will be enable.</param>
		/// <returns>
		/// 	An instance of Page with its complete tree loaded.
		/// 	The return item could be null if there isn't an item with the specified key into the repository.
		/// </returns>
		///<exception cref="ArgumentOutOfRangeException"> If <paramref name="key"/> is lesser then 1.</exception>
		Page GetByKeyWithParent ( int key , bool enableTracking );

		///<summary>
		///	Retireve a paged list of all <see cref="Page"/>.
		///</summary>
		/// <remarks>
		///		The result will include published only pages.
		///		Moreover the result hasn't the tracking system enabled
		/// </remarks>
		///<param name = "pageIndex">Index of the page (0 based).</param>
		///<param name = "pageSize">The number of items to retrieve.</param>
		/// <param name = "enableTracking">if set to <c>true</c> the tracking system of the return object will be enable.</param>
		///<returns>An concrete implementation of <see cref="IPagedResult{T}"/>. The result will never be null.</returns>
		IPagedResult <Page> GetPages ( int pageIndex , int pageSize , bool enableTracking );

		/// <summary>
		/// 	Retrieve the complete pages structure roots with all childs and parent loaded.
		///     This might me used to generate a pages menu
		/// </summary>
		/// <returns>
		/// 	A set of instances of PageStructure with its complete tree loaded.
		/// 	The return item could be null if there aren't pages into the repository.
		/// </returns>
		IEnumerable<PageStructure> GetPagesStructureRoot();

		/// <summary>
		/// 	Retrieve the complete pages structure roots with all childs and parent loaded
		///     This might me used to generate a pages menu
		/// </summary>
		/// <param name = "enableTracking">if set to <c>true</c> the tracking system of the return object will be enable.</param>
		/// <returns>
		/// 	A set of instances of PageStructure with its complete tree loaded.
		/// 	The return item could be null if there aren't pages into the repository.
		/// </returns>
		IEnumerable<PageStructure> GetPagesStructureRoot(bool enableTracking);

		/// <summary>
		/// 	Retrieve the complete pages structure with all childs and parent loaded
		/// </summary>
		/// <returns>
		/// 	A set of  instances of PageStructure with its complete tree loaded.
		/// 	The return item could be null if there aren't pages into the repository.
		/// </returns>
		IEnumerable <PageStructure> GetPagesStructure ( );

		/// <summary>
		/// 	Retrieve the complete pages structure with all childs and parent loaded
		/// </summary>
		/// <param name = "enableTracking">if set to <c>true</c> the tracking system of the return object will be enable.</param>
		/// <returns>
		/// 	A set of  instances of PageStructure with its complete tree loaded.
		/// 	The return item could be null if there aren't pages into the repository.
		/// </returns>
		IEnumerable <PageStructure> GetPagesStructure ( bool enableTracking );

		///<summary>
		///	Retrieve a paged list of pages structure with all childs and parent loaded
		///</summary>
		///<param name = "pageIndex">Index of the page (0 based).</param>
		///<param name = "pageSize">The number of items to retrieve.</param>
		///<returns>An concrete implementation of <see cref="IPagedResult{T}"/>. The result will never be null.</returns>
		///<exception cref="ArgumentOutOfRangeException"> If <paramref name="pageIndex"/> is lesser than 0.</exception>
		///<exception cref="ArgumentOutOfRangeException"> If <paramref name="pageSize"/> is lesser than 1.</exception>
		IPagedResult <PageStructure> GetPagesStructureList ( int pageSize , int pageIndex );

		///<summary>
		///	Retrieve a paged list of pages structure with all childs and parent loaded
		///</summary>
		///<param name = "pageIndex">Index of the page (0 based).</param>
		///<param name = "pageSize">The number of items to retrieve.</param>
		/// <param name = "enableTracking">if set to <c>true</c> the tracking system of the return object will be enable.</param>
		///<returns>An concrete implementation of <see cref="IPagedResult{T}"/>. The result will never be null.</returns>
		///<exception cref="ArgumentOutOfRangeException"> If <paramref name="pageIndex"/> is lesser than 0.</exception>
		///<exception cref="ArgumentOutOfRangeException"> If <paramref name="pageSize"/> is lesser than 1.</exception>
		IPagedResult <PageStructure> GetPagesStructureList ( int pageSize , int pageIndex , bool enableTracking );

		/// <summary>
		/// 	Retrieve all used slugs from the Pages.
		/// </summary>
		/// A set of  strings.
		/// The return item could be null if there aren't pages into the repository.
		///<returns>An array of slugs.</returns>
		IList<string> GetAllPagesSlugs ( );

		/// <summary>
		/// 	This method remove a page and all childs from the repository.
		/// </summary>
		/// <param name = "item">The item to delete.</param>
		///<exception cref="ArgumentNullException"> If <paramref name="item"/> is <c>null</c>.</exception>
		void Delete ( Page item );

		/// <summary>
		/// 	Saves the specified page.
		/// </summary>
		/// <param name = "item">The item to save.</param>
		///<exception cref="ArgumentNullException"> If <paramref name="item"/> is <c>null</c>.</exception>
		void Save ( Page item );

		/// <summary>
		/// 	Updates the specified page.
		/// </summary>
		/// <param name = "item">The item to update.</param>
		///<exception cref="ArgumentNullException"> If <paramref name="item"/> is <c>null</c>.</exception>
		void Update ( Page item );
	}
}
